﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Chowpoo.Sql;
using CourseSystem.Core.Entities;

namespace CourseSystem.Core.SqlServerDAL
{
    public class ExamStatusDAL : CommonDal<ExamStatusInfo>
    {
        public ExamStatusDAL()
            : base(Settings.ConnectionName)
        {
        }

        public ExamStatusDAL(string mConnectionStringName)
            : base(mConnectionStringName)
        {
        }

        public bool SetEnforceSubmitAll(int eid)
        {
            using (var dc = DataContext<ExamStatusInfo>.CreateContext(ConnectionStringName))
            {
                return dc.ExecuteCommand("update examstatus set IsEnforceSubmit=1 where eid={0}", eid) > 0;
            }
        }

        public bool SetWarnAll(int eid)
        {
            using (var dc = DataContext<ExamStatusInfo>.CreateContext(ConnectionStringName))
            {
                return dc.ExecuteCommand("update examstatus set IsWarning=1 where eid={0}", eid) > 0;
            }
        }
    }
}
